using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.BizTalk.BaseFunctoids;
using System.Reflection;

namespace eliasen.eu.BizTalk.Functoids
{
    class NewGUID : BaseFunctoid
    {
        public NewGUID()
            : base()
		{
			//ID for this functoid
            this.ID = 6425;

			// resource assembly must be ProjectName.ResourceName if building with VS.Net
            SetupResourceAssembly("eliasen.eu.BizTalk.Functoids.eliasen.eu.BizTalk.Functoids.Resources", Assembly.GetExecutingAssembly());

			//Setup the Name, ToolTip, Help Description, and the Bitmap for this functoid
            SetName("Str_NewGUID_Name");
            SetTooltip("Str_NewGUID_Tooltip");
            SetDescription("Str_NewGUID_Description");
            SetBitmap("Bmp_NewGUID_Icon");

			this.SetMinParams(0);
			this.SetMaxParams(0);

			//set the function name that needs to be called when this Functoid is invoked. This means that
			//this Functoid assembly need to be present in GAC for its availability during Test..Map and Runtime.
            SetExternalFunctionName(GetType().Assembly.FullName, "eliasen.eu.BizTalk.Functoids.NewGUID", "GetNewGUID");

			//category for this functoid. This functoid goes under the String Functoid Tab in the
			//VS.Net toolbox for functoids.
			this.Category = FunctoidCategory.String;
			this.OutputConnectionType = ConnectionType.AllExceptRecord;
		}

		//this is the function that gets called when the Map is executed which has this functoid.
        public string GetNewGUID()
        {
            return Guid.NewGuid().ToString();
        }
    }
}
